

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.AirlineReservationServiceProxy;
import bean.Journey;
import bean.ReservationDetails;
import bean.Traveler;
import constants.AirlineReservationServiceConstants;

/**
 * Servlet implementation class GetPassengersServlet
 */
public class GetPassengersServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		AirlineReservationServiceProxy proxy = new AirlineReservationServiceProxy(
				AirlineReservationServiceConstants.SERVICE_URL);
		
		long flightId = Long.parseLong(req.getParameter("flightId"));
		String journeyDate=req.getParameter("journeyDate");
		
		ReservationDetails[] reservationDetails = proxy.viewAllPassengers(flightId,journeyDate);
	
		List<ReservationDetails> lstReservation=Arrays.asList(reservationDetails);
		

		req.setAttribute("lstAllPassengers", lstReservation);		
		req.getRequestDispatcher("viewAllPassengers.jsp").forward(req,resp);

	}

		
	}

	


